// fetch
import { fetchData } from './request'

// parseTextToObjects方法
// import { parseTextToObjects } from './parseTextToObjects'

import { jsonToUrlParam, queryString } from './request'

const fetchPostObjData = (url, data) => {
  return fetchData(url, { method: "post", body: jsonToUrlParam(data), headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(text => {
    console.log("serives set :" + text)
  })
}

// NoDe 中table 表格数据
export const getProductsSmall = () => {
  return fetchData('/api/wwsh/node/list', { method: "get" }).then((text) => {
    const rows = text.split('\n').map(row => row.trim());
    const tableData = rows.map(row => row.split(/\s+/));
    return tableData.filter(row => row.length > 1);
  });
}